package com.hery.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.hery.utils.BeanToMap;
import lombok.Data;
import lombok.ToString;

import java.util.List;

/**
 * Sentry 上报 Kafka 的日志格式
 * [2,\"insert\",{\"group_id\":null,\"event_id\":\"a002b22853bd414fb2b4546ce3582428\",\"organization_id\":1,\"project_id\":3,\"message\":\"MainActivity\",\"platform\":\"java\",\"datetime\":\"2021-06-21T01:01:18.022000Z\",\"data\":{\"event_id\":\"a002b22853bd414fb2b4546ce3582428\",\"level\":\"info\",\"version\":\"7\",\"type\":\"transaction\",\"transaction\":\"MainActivity\",\"logger\":\"\",\"platform\":\"java\",\"timestamp\":1624237278.022,\"start_timestamp\":1624000110.844,\"received\":1624237309.13174,\"release\":\"ltd.qisi.flavorsdemos.c100@1.0+1\",\"dist\":\"1\",\"environment\":\"debug\",\"user\":{\"id\":\"4812dcc0-a685-4178-8b7d-32212cdeefe0\"},\"contexts\":{\"app\":{\"app_start_time\":\"2021-06-18T07:08:27.620Z\",\"app_identifier\":\"ltd.qisi.flavorsdemos.c100\",\"app_name\":\"C100\",\"app_version\":\"1.0\",\"app_build\":\"1\",\"type\":\"app\"},\"device\":{\"name\":\"Nexus 5X\",\"family\":\"Nexus\",\"model\":\"Nexus 5X\",\"model_id\":\"OPM7.181205.001\",\"orientation\":\"landscape\",\"manufacturer\":\"LGE\",\"brand\":\"google\",\"screen_density\":2.4916666,\"screen_dpi\":398,\"simulator\":false,\"boot_time\":\"2021-06-17T09:13:17.637Z\",\"timezone\":\"Asia/Shanghai\",\"archs\":[\"arm64-v8a\",\"armeabi-v7a\",\"armeabi\"],\"id\":\"4812dcc0-a685-4178-8b7d-32212cdeefe0\",\"language\":\"zh_CN_#Hans\",\"screen_height_pixels\":1080,\"screen_width_pixels\":1794,\"type\":\"device\"},\"os\":{\"name\":\"Android\",\"version\":\"8.1.0\",\"build\":\"OPM7.181205.001\",\"kernel_version\":\"3.10.73-g89fd15db99aa\",\"rooted\":false,\"type\":\"os\"},\"trace\":{\"trace_id\":\"76272d27ad1a460e9653a7ff4b0e0676\",\"span_id\":\"a07e2382e7ad45b3\",\"op\":\"navigation\",\"status\":\"ok\",\"name\":\"MainActivity\",\"type\":\"trace\"}},\"breadcrumbs\":{\"values\":[{\"timestamp\":1624000107.738,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"CrashActivity\",\"state\":\"created\"}},{\"timestamp\":1624000107.935,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"CrashActivity\",\"state\":\"started\"}},{\"timestamp\":1624000107.937,\"type\":\"session\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"start\"}},{\"timestamp\":1624000107.938,\"type\":\"navigation\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"foreground\"}},{\"timestamp\":1624000107.942,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"CrashActivity\",\"state\":\"resumed\"}},{\"timestamp\":1624000109.311,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"CrashActivity\",\"state\":\"paused\"}},{\"timestamp\":1624000109.409,\"type\":\"navigation\",\"category\":\"device.orientation\",\"level\":\"info\",\"data\":{\"position\":\"portrait\"}},{\"timestamp\":1624000109.414,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"CONFIGURATION_CHANGED\"}},{\"timestamp\":1624000109.694,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"CrashActivity\",\"state\":\"stopped\"}},{\"timestamp\":1624000109.704,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"CrashActivity\",\"state\":\"destroyed\"}},{\"timestamp\":1624000110.012,\"type\":\"navigation\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"background\"}},{\"timestamp\":1624000110.8,\"type\":\"navigation\",\"category\":\"device.orientation\",\"level\":\"info\",\"data\":{\"position\":\"landscape\"}},{\"timestamp\":1624000110.84,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"created\"}},{\"timestamp\":1624000110.965,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"started\"}},{\"timestamp\":1624000110.967,\"type\":\"navigation\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"foreground\"}},{\"timestamp\":1624000110.971,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"resumed\"}},{\"timestamp\":1624000111.015,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"CONFIGURATION_CHANGED\"}},{\"timestamp\":1624010711.448,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"ACTION_POWER_DISCONNECTED\",\"extras\":{\"seq\":\"1354\"}}},{\"timestamp\":1624010742.05,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"paused\"}},{\"timestamp\":1624010742.088,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"saveInstanceState\"}},{\"timestamp\":1624010742.11,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"stopped\"}},{\"timestamp\":1624010742.286,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DREAMING_STARTED\"}},{\"timestamp\":1624010742.751,\"type\":\"navigation\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"background\"}},{\"timestamp\":1624010744.046,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"SCREEN_OFF\"}},{\"timestamp\":1624010746.625,\"type\":\"navigation\",\"category\":\"device.orientation\",\"level\":\"info\",\"data\":{\"position\":\"portrait\"}},{\"timestamp\":1624010746.627,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"CONFIGURATION_CHANGED\"}},{\"timestamp\":1624010752.754,\"type\":\"session\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"end\"}},{\"timestamp\":1624015094.607,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624017875.729,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624018175.718,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624024698.731,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624025301.919,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624039580.796,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DATE_CHANGED\"}},{\"timestamp\":1624039580.884,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624040121.449,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624061259.092,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624061809.776,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624082696.214,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624083247.934,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624104087.947,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624104118.052,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624124934.218,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DATE_CHANGED\"}},{\"timestamp\":1624124934.31,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624124994.809,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624146556.472,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624147156.365,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624167921.51,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624168521.595,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624189227.648,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624189831.345,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624211264.724,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DATE_CHANGED\"}},{\"timestamp\":1624211264.866,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624211817.37,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624232547.879,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624233139.489,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624237221.126,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"ACTION_POWER_CONNECTED\",\"extras\":{\"seq\":\"1559\"}}},{\"timestamp\":1624237221.229,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DEVICE_IDLE_MODE_CHANGED\"}},{\"timestamp\":1624237221.452,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"DREAMING_STOPPED\"}},{\"timestamp\":1624237221.613,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"SCREEN_ON\"}},{\"timestamp\":1624237275.873,\"type\":\"navigation\",\"category\":\"device.orientation\",\"level\":\"info\",\"data\":{\"position\":\"landscape\"}},{\"timestamp\":1624237275.884,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"started\"}},{\"timestamp\":1624237275.889,\"type\":\"session\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"start\"}},{\"timestamp\":1624237275.89,\"type\":\"navigation\",\"category\":\"app.lifecycle\",\"level\":\"info\",\"data\":{\"state\":\"foreground\"}},{\"timestamp\":1624237275.891,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"resumed\"}},{\"timestamp\":1624237275.898,\"type\":\"system\",\"category\":\"device.event\",\"level\":\"info\",\"data\":{\"action\":\"CONFIGURATION_CHANGED\"}},{\"timestamp\":1624237277.626,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"paused\"}},{\"timestamp\":1624237277.963,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"stopped\"}},{\"timestamp\":1624237278.011,\"type\":\"navigation\",\"category\":\"ui.lifecycle\",\"level\":\"info\",\"data\":{\"screen\":\"MainActivity\",\"state\":\"destroyed\"}}]},\"tags\":[[\"isSideLoaded\",\"true\"],[\"level\",\"info\"],[\"environment\",\"debug\"],[\"transaction\",\"MainActivity\"],[\"sentry:release\",\"ltd.qisi.flavorsdemos.c100@1.0+1\"],[\"sentry:dist\",\"1\"],[\"sentry:user\",\"id:4812dcc0-a685-4178-8b7d-32212cdeefe0\"],[\"device\",\"Nexus 5X\"],[\"device.family\",\"Nexus\"],[\"os\",\"Android 8.1.0\"],[\"os.name\",\"Android\"],[\"os.rooted\",\"no\"]],\"sdk\":{\"name\":\"sentry.java.android\",\"version\":\"1.0\",\"packages\":[{\"name\":\"maven:io.sentry:sentry\",\"version\":\"1.0\"},{\"name\":\"maven:io.sentry:sentry-android-core\",\"version\":\"1.0\"}],\"integrations\":null},\"key_id\":\"3\",\"project\":3,\"grouping_config\":{\"enhancements\":\"eJybzDRxY3J-bm5-npWRgaGlroGxrpHxBABcYgcZ\",\"id\":\"newstyle:2019-10-29\"},\"spans\":[],\"_metrics\":{\"bytes.ingested.event\":11185,\"bytes.stored.event\":11129},\"metadata\":{\"title\":\"MainActivity\",\"location\":\"MainActivity\"},\"title\":\"MainActivity\",\"location\":\"MainActivity\",\"culprit\":\"MainActivity\"},\"primary_hash\":\"d41d8cd98f00b204e9800998ecf8427e\",\"retention_days\":90},{\"is_new\":false,\"is_regression\":false,\"is_new_group_environment\":false,\"skip_consume\":false}]"
 */
@Data
@Deprecated
public class SentryLog  extends BeanToMap {

    private int group_id;
    private String event_id;
    private int organization_id;
    private int project_id;
    private String message;
    private String platform;
    private String datetime;
    @JSONField(name = "data")
    private SentryData sentryData;
    private String primary_hash;
    private int retention_days;

    @Data
    public static class SentryData extends BeanToMap{
        private String event_id;
        private String level;
        private String version;
        private String type;
        private String logger;
        private String platform;
        private double timestamp;
        private double received;
        private String release;
        private String environment;
        private User user;
        private Contexts contexts;
        @JSONField(name = "exception")
        private MyException exception;
        private List<List<String>> tags;
        private Sdk sdk;
        private String key_id;
        private int project;
        private Grouping_config grouping_config;
        @JSONField(name = "_metrics")
        private Metrics metrics;
        private List<String> fingerprint;
        private List<String> hashes;
        private Metadata metadata;
        private String title;
        private String location;
        private String culprit;
        @JSONField(name = "_ref")
        private int ref;
        @JSONField(name = "_ref_version")
        private int refVersion;

        @Data
        private static class User extends BeanToMap{
            String id;
        }

        @Data
        @ToString
        public static class Contexts extends BeanToMap{

            private App app;
            private Device device;
            private Os os;

            @Data
            public static class App extends BeanToMap{

                @JSONField(name = "app_start_time")
                private String appStartTime;
                @JSONField(name = "app_identifier")
                private String appIdentifier;
                @JSONField(name = "app_name")
                private String appName;
                @JSONField(name = "app_version")
                private String appVersion;
                @JSONField(name = "app_build")
                private String appBuild;
                private String type;
            }

            @Data
            private static class Device extends BeanToMap{
                private String name;
                private String family;
                private String model;
                @JSONField(name = "model_id")
                private String model_id;
                @JSONField(name = "battery_level")
                private int batteryLevel;
                private String orientation;
                private String manufacturer;
                private String brand;
                @JSONField(name = "screen_density")
                private double screen_density;
                @JSONField(name = "screen_dpi")
                private int screenDpi;
                private boolean online;
                private boolean charging;
                @JSONField(name = "low_memory")
                private boolean lowMemory;
                private boolean simulator;
                @JSONField(name = "memory_size")
                private long memorySize;
                @JSONField(name = "free_memory")
                private long freeMemory;
                @JSONField(name = "storage_size")
                private long storageSize;
                @JSONField(name = "free_storage")
                private long freeStorage;
                @JSONField(name = "external_storage_size")
                private long externalStorageSize;
                @JSONField(name = "external_free_storage")
                private long externalFreeStorage;
                @JSONField(name = "boot_time")
                private String bootTime;
                private String timezone;
                private List<String> archs;
                @JSONField(name = "battery_temperature")
                private int batteryTemperature;
                @JSONField(name = "connection_type")
                private String connectionType;
                private String id;
                private String language;
                @JSONField(name = "screen_height_pixels")
                private int screenHeightPixels;
                @JSONField(name = "screen_width_pixels")
                private int screenWidthPixels;
                private String type;

            }

            @Data
            private static class Os extends BeanToMap {

                private String name;
                private String version;
                private String build;
                @JSONField(name = "kernel_version")
                private String kernelVersion;
                private boolean rooted;
                private String type;

            }

        }

        @Data
        private static class MyException extends BeanToMap {

            private List<Values> values;

            @Data
            private static class Values {

                private String type;
                private String value;
                private String module;
                private Stacktrace stacktrace;
                private int thread_id;
                private Mechanism mechanism;

                @Data
                private static class Stacktrace {

                    private List<Frames> frames;

                    @Data
                    private static class Frames {

                        private String function;
                        private String module;
                        private String filename;
                        private String abs_path;
                        private int lineno;
                        private boolean in_app;
                        private String colno;
                        private String context_line;
                        private String data;
                        private String errors;
                        private String raw_function;
                        private String image_addr;
                        private String instruction_addr;
                        private String addr_mode;
                        private String pkg;
                        private String platform;
                        private String post_context;
                        private String pre_context;
                        private String symbol;
                        private String symbol_addr;
                        private String trust;
                        private String vars;
                        private String snapshot;
                    }
                }

                @Data
                private static class Mechanism {

                    private String type;
                    private boolean handled;
                    private String synthetic;
                    private String description;
                    @JSONField(name = "help_link")
                    private String helpLink;
                    private String data;
                    private String meta;
                }
            }
        }

        @Data
        private static class Sdk extends BeanToMap {

            private String name;
            private String version;
            @JSONField(name = "package")
            private List<Packages> pkgs;
            private String integrations;

            @Data
            private static class Packages extends BeanToMap {

                private String name;
                private String version;
            }
        }

        @Data
        private static class Grouping_config extends BeanToMap {

            private String enhancements;
            private String id;
        }

        @Data
        private static class Metrics extends BeanToMap {

            @JSONField(name = "bytes.ingested.event")
            private int bytesIngestedEvent;
            @JSONField(name = "bytes.stored.event")
            private int bytesStoredEvent;
        }

        @Data
        private static class Metadata extends BeanToMap {

            private String value;
            private String type;
            private String filename;
            private String function;
        }


    }

    
}

